<template>
    <div id="modifyPhone">
        <div class="title">手机号修改</div>
        <div class="content">
            <div id="information">
                <div class="left">原手机号：</div>
                <div class="right">{{oldPhone == ""?"还未绑定手机号":oldPhone}}</div>
            </div>
            <div id="information">
                <div class="left">新手机号：</div>
                <el-input v-model="phoneInput" placeholder="请输入手机号" class="input"></el-input>
            </div>
            <div id="information" class="verifyCode">
                <div class="left">验证码：</div>
                <el-input v-model="codeInput" placeholder="请输入短信验证码"></el-input>
                <div class="rightButton" v-if="phoneTimeShow" @click="sendCode">发送验证码</div>
                <div class="anewRightButton" v-if="!phoneTimeShow" @click="sendCode">重新发送（{{phoneTime}}）</div>
            </div>
            <div class="button">确认</div>
        </div>
    </div>
</template>

<script>
export default {
	data() {
		return {
            oldPhone: "", // 原手机号
            phoneInput: "", // 新手机号输入值
            codeInput: "", // 验证码输入值
            phoneTime: 60,
            phoneTimeShow: true, // 控制验证码的显示隐藏
        };
	},
    mounted(){},
	methods: {
        // 手机号点击发送验证码
        sendCode(){
			// console.log("手机号发送验证码")
            this.phoneTimeShow = false
            this.timer = setInterval(()=>{
                this.phoneTime--
                if(this.phoneTime === 0){
                    this.phoneTimeShow = true
                    clearInterval(this.timer)
                }
            },1000)
		},
    },
}
</script>

<style scoped lang="less">
@media screen and (min-width: 1400px){    
    #modifyPhone{
        padding: 3% 5%;
        font-size: 16px;
        .title{
            width: 100%;
            font-size: 24px;
            padding-bottom: 2%;
            border-bottom: 1px solid #ddd;
        }
        .content{
            margin-top: 7%;
            #information{
                width: 60%;
                margin-top: 3%;
                margin-left: 15%;
                display: flex;
                justify-content: center;
                align-items: center;
                .left{
                    width: 30%;
                    text-align: right;
                }
                .right{
                    width: 69%;
                    color: #ccc;
                    line-height: 40px;
                }
                .input{
                    width: 69% !important;
                    line-height: 40px;
                }
            }
            // 验证码
            .verifyCode{
                width: 60%;
                margin-top: 3%;
                margin-left: 15%;
                display: flex;
                align-content: center;
                align-items: center;
                .left{
                    width: 20%;
                    text-align: right;
                }
                .el-input{
                    width: 35%;
                    margin-right: 2%;
                }
                .rightButton{
                    width: 33%;
                    line-height: 40px;
                    text-align: center;
                    color: white;
                    background: #F39E2A;
                }
                .anewRightButton{
                    width: 33%;
                    line-height: 40px;
                    text-align: center;
                    color: white;
                    background: url("../../image/weixuanzhong.png") no-repeat 100%;
                }
            }
        }
        // 确认
        .button{
            width: 20%;
            margin: 10% 0% 0% 40%;
            text-align: center;
            border-radius: 5px;
            padding: 1% 0%;
            font-size: 16px;
            color: white;
            background: #F39E2A;
        }
    }
}



@media screen and (max-width: 1400px){    
    #modifyPhone{
        padding: 2% 4%;
        font-size: 14px;
        .title{
            width: 100%;
            font-size: 22px;
            padding-bottom: 2%;
            border-bottom: 1px solid #ddd;
        }
        .content{
            margin-top: 6%;
            #information{
                width: 60%;
                margin-top: 2%;
                margin-left: 15%;
                display: flex;
                justify-content: center;
                align-items: center;
                .left{
                    width: 30%;
                    text-align: right;
                }
                .right{
                    width: 69%;
                    color: #ccc;
                    line-height: 40px;
                }
                .input{
                    width: 69% !important;
                    line-height: 40px;
                }
            }
            // 验证码
            .verifyCode{
                width: 60%;
                margin-top: 2%;
                margin-left: 15%;
                display: flex;
                align-content: center;
                align-items: center;
                .left{
                    width: 20%;
                    text-align: right;
                }
                .el-input{
                    width: 35%;
                    margin-right: 2%;
                }
                .rightButton{
                    width: 33%;
                    line-height: 40px;
                    text-align: center;
                    color: white;
                    background: #F39E2A;
                }
                .anewRightButton{
                    width: 33%;
                    line-height: 40px;
                    text-align: center;
                    color: white;
                    background: url("../../image/weixuanzhong.png") no-repeat 100%;
                }
            }
        }
        // 确认
        .button{
            width: 20%;
            margin: 8% 0% 0% 40%;
            text-align: center;
            border-radius: 5px;
            padding: 1% 0%;
            font-size: 14px;
            color: white;
            background: #F39E2A;
        }
    }
}
</style>